import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['svg.fonttype'] = 'none'

# 创建数据框架
data = {
    'Node Nums': [40, 80, 120, 160, 200, 240, 280, 320],
    'SPS': [0.28614555623508303,
  0.3240244004083558,
  0.2740892642385659,
  0.2534583330329368,
  0.211757637557884,
  0.15680322987540588,
  0.1413664695454486,
  0.10707420587410033],
    'OGS': [0.254737103643475,
  0.20149031477068494,
  0.19362018958078053,
  0.16560123401869603,
  0.15240065096994782,
  0.13310320367400727,
  0.13149085990103493,
  0.11999803229555565],
    'ORDP': [0.7173554787144992,
  0.6009574673377225,
  0.44309401347237565,
  0.3690341627770943,
  0.27412262528015496,
  0.22424832777028184,
  0.17228337018182116,
  0.154148904370003],
}

df = pd.DataFrame(data)

# 绘制数据
plt.figure(figsize=(8, 6))
plt.plot(df['Node Nums'], df['SPS'], marker='s', markersize=10, label='SPS')
plt.plot(df['Node Nums'], df['OGS'], marker='^', markersize=10, label='OGS')
plt.plot(df['Node Nums'], df['ORDP'], marker='*', markersize=10, label='ORDP')

# plt.title('Comparison of SPF and Cplex Algorithms')
plt.xlabel('Number of Nodes', fontsize=14)
plt.ylabel('Jain\'s Index', fontsize=14)
plt.legend(fontsize='large')  # 设置图例的字体大小为大

plt.grid(True)
# plt.show()
plt.savefig("output/jain.svg", format="svg")
